package org.yufan.service.impl;

import org.springframework.stereotype.Service;
import org.yufan.bean.Item;
import org.yufan.front.bean.ItemBean;
import org.yufan.service.ItemService;
import org.yufan.utils.HttpClientUtil;
import org.yufan.utils.JsonUtils;

@Service
public class ItemHttpServiceImpl implements ItemService {

    public static final String ITEM_URL="http://manage.yufan.com/rest/rpc/item/";

    @Override
    public Item queryItemById(Long itemId) {
        String json= HttpClientUtil.doGet(ITEM_URL+itemId);
        ItemBean itemBean = JsonUtils.jsonToPojo(json, ItemBean.class);
        Item item = itemBean.getData();
        return item;
    }


}
